package com.tz.actions;

import com.opensymphony.xwork2.ActionSupport;
import com.tz.entity.Faq;
import com.tz.service.FaqService;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 问答类服务器
 * Created by Administrator on 2016/8/5.
 */
@Namespace("/faq")
@ParentPackage("json-default")
public class FaqAction extends ActionSupport{
    //c->v
    private List<Faq> faqList;

    @Autowired
    private FaqService faqService;

    @Action(value = "list",results = {
        @Result(type = "json",params = {"root","faqList"})
    })
    public String list(){
        faqList = faqService.findAll();
        return SUCCESS;
    }

    public List<Faq> getFaqList() {
        return faqList;
    }

    public void setFaqList(List<Faq> faqList) {
        this.faqList = faqList;
    }
}
